//
//  PlayerMenuScene.m
//  ProjectLila
//
//  Created by Tedo on 6/22/10.
//  Copyright 2010 sushigames. All rights reserved.
//

#import "PlayerMenuScene.h"
#import "MainMenuScene.h"
#import "GameScene.h"


@implementation PlayerMenuLayer

- (id) init {
	self = [super init];
	if (self) {
		[CCMenuItemFont setFontSize:34];
        [CCMenuItemFont setFontName:@"Verdana"];
        CCMenuItem *campaign = [CCMenuItemFont itemFromString:@"Campaign"
												  target:self
												selector:@selector(campaign:)];
        CCMenuItem *mastery = [CCMenuItemFont itemFromString:@"Edit Mastery"
												   target:self
												 selector:@selector(stub:)];
		[mastery setIsEnabled:NO];
        CCMenu *menu = [CCMenu menuWithItems:campaign, mastery, nil];
        [menu alignItemsHorizontallyWithPadding:400];
        [self addChild:menu];
		
		// exit button
		CGSize size = [[CCDirector sharedDirector] winSize];
		[CCMenuItemFont setFontSize:24];
        [CCMenuItemFont setFontName:@"Verdana"];
        CCMenuItem *exit = [CCMenuItemFont itemFromString:@"Exit"
												   target:self
												 selector:@selector(exit:)];
        menu = [CCMenu menuWithItems:exit, nil];
		[menu setPosition:ccp( size.width/10, size.height/10 )];
		[self addChild:menu];
	}
	return self;
}

- (void)campaign:(id)sender {
	GameScene *scene = [GameScene sceneWithLevel:@"campaign1-1"];
	[[CCDirector sharedDirector] replaceScene:[CCFadeTransition transitionWithDuration:0.5f scene:scene]];
}

- (void)exit:(id)sender {
	[[CCDirector sharedDirector] replaceScene:[CCFadeTransition transitionWithDuration:0.5f scene:[MainMenuScene scene]]];
}

- (void)stub:(id)sender {
}

@end


@implementation PlayerMenuScene

+ (id) scene {
	PlayerMenuScene *scene = [PlayerMenuScene node];
	
	[scene addChild:[PlayerMenuLayer node]];
	
	return scene;
}

@end
